﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArkadiaOsKernel.Core.Filesystem.Vfs
{
    class Filesystem
    {
        public static List<Disk> Disks = new List<Disk>();
        private static int i;
        #region " Add Disk Handlers "
        public void AddDisk(Disk newdisk)
        {
            Disks.Add(newdisk);
        }
        #endregion
        #region " Remove Disk Handlers "
        public void RemoveDisk(string letter)
        {
            for (i = 0; i < Disks.Count; i++)
            {
                if (Disks[i].driveletter == letter)
                {
                    Disks.RemoveAt(i);
                    break;
                }
            }
        }
        public void RemoveDisk(int i)
        {
            Disks.RemoveAt(i);
        }
        #endregion
        #region " Disk Handlers "
        public int GetDisks()
        {
            return Disks.Count;
        }
        public Disk GetDisk(string letter)
        {
            for (i = 0; i < Disks.Count; i++)
            {
                if (Disks[i].driveletter == letter)
                {
                    return Disks[i];
                }
            }
            return new Disk();
        }
        public void SwapDisks(Disk NewDisk, string letter)
        {
            for (i = 0; i < Disks.Count; i++)
            {
                if (Disks[i].driveletter == letter)
                {
                    Disks[i] = NewDisk;
                    break;
                }
            }
        }
        #endregion 
    }
}
